﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JiHua_MX.aspx.cs" Inherits="syc.Produce.JiHua_MX" %>
<html>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
    <div id="wintop" class="wintop">
        <asp:Label ID="JiHuaMC" runat="server" Text=""></asp:Label> 明细</div>
     <asp:Panel ID="Panel2" runat="server" CssClass="panel">
        <table style="width: 100%;font-size:13px;">
            <tr>
                <td width="100" align="right">生产产品：

                </td>
                <td valign="top">

                    <asp:DropDownList ID="ChanPin" runat="server" Width="200px" 
                        DataSourceID="SqlDataSource2" DataTextField="品名规格" DataValueField="ID">
                    </asp:DropDownList>

                </td>

            </tr>

            <tr>
                <td width="100" style="text-align: right">
                    生产单位：</td>
                <td valign="top">
                    <asp:DropDownList ID="DanWei" runat="server" Width="200px" 
                        DataSourceID="SqlDataSource3" DataTextField="名称" DataValueField="ID">
                    </asp:DropDownList>
                </td>
            </tr>

            <tr>
                <td style="text-align: right" width="100">
                    计划产量：</td>
                <td valign="top">
                    <asp:TextBox ID="ChanLiang" runat="server" Width="200px"></asp:TextBox>
                    <asp:Button ID="Button_Save" runat="server" CssClass="button" Text="增 加" 
                        onclick="Button_Save_Click" />
                    <asp:Button ID="Button_Finish" runat="server" CssClass="button" Text="完 成" 
                        onclick="Button_Finish_Click" />
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                        SelectCommand="SELECT [ID], [品名]+' '+ [规格]+'('+[单位]+')' as [品名规格] FROM [产品]"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                        SelectCommand="SELECT [ID], [名称] FROM [生产单位]"></asp:SqlDataSource>
                </td>
            </tr>

        </table>

    </asp:Panel>

    <asp:Panel ID="Panel3" runat="server" CssClass="panel2" >
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>
        
        
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#d0d0d0">
	            <tr>
		            <td class="grid-title">生产计划明细</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
                            UpdateCommand="update [生产计划明细] set [数量]=@数量 where [ID]=@ID"
                            DeleteCommand="delete from [生产计划明细] where [ID]=@ID"
                            ></asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID" 
                            DataSourceID="SqlDataSource1" 
                            GridLines="None" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                            UseAccessibleHeader="False" onrowdeleted="GridView1_RowDeleted" 
                            onrowediting="GridView1_RowEditing" onrowupdated="GridView1_RowUpdated" 
                            onsorted="GridView1_Sorted" 
                            onrowcancelingedit="GridView1_RowCancelingEdit">
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <Columns>


                                <asp:TemplateField HeaderText="生产单位" SortExpression="生产单位名称">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("生产单位名称") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="160px" />
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="产品及规格" SortExpression="产品及规格">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("产品及规格") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="160px" />
                                </asp:TemplateField>
                                

                                
                                <asp:TemplateField HeaderText="计划产量" SortExpression="数量">
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("数量") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("数量") %>' Width="96"></asp:TextBox>
                                    </EditItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>


                                
                                <asp:TemplateField HeaderText="操作" ShowHeader="False" ItemStyle-CssClass="grid"
                                 HeaderStyle-CssClass="grid-header" HeaderStyle-Width="100" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CommandName="Edit" Text="修改" CssClass="smallbutton"/>
                                        <asp:Button ID="Button2" runat="server" CommandName="Delete" Text="删除" CssClass="smallbutton"/>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:Button ID="Button3" runat="server" CommandName="Update" Text="更新" CssClass="smallbutton"/>
                                        <asp:Button ID="Button4" runat="server" CommandName="Cancel" Text="取消" CssClass="smallbutton"/>
                                    </EditItemTemplate>
                                    
<HeaderStyle CssClass="grid-header" Width="100px"></HeaderStyle>

<ItemStyle HorizontalAlign="Center" CssClass="grid"></ItemStyle>
                                    
                                </asp:TemplateField>
                            </Columns>
                          </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td align="right">
                                    <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
    </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }
</script>
</body>
</html>
